//
//  HGiftViewModel.m
//  linktuIOS
//
//  Created by hejunsong on 2017/1/15.
//  Copyright © 2017年 tianxie. All rights reserved.
//

#import "HGiftViewModel.h"
#import "giftModel.h"
#import "HMessageTool.h"

#import "MTLiveApiManager.h"

@implementation HGiftViewModel

-(void)refreshGiftsuccess:(void (^)(BOOL success))result;
{
    [[MTLiveApiManager manager] getGiftsWithComplation:^(NSMutableArray<giftModel *> *gifts, MTError *error) {
       if(error == nil)
       {
           self.giftArray = gifts;
           for (int i = 0; i < self.giftArray.count; i++) {
           giftModel *model = self.giftArray[i];
           if(i == 0)
           {
               model.isSelected = @"1";
               self.selectGiftMdoel = model;
           }else
           {
               model.isSelected = @"0";
           }
//           [[[HMessageTool messgeTool] giftdict] setObject:model forKey:model.gift_code];
       }
       dispatch_async(dispatch_get_main_queue(), ^{
           result(YES);
       });
           
       }
    }];
}

@end
